package singles

import (
	"github.com/go-resty/resty/v2"
	"showurl/static-file/kplayer/apis/config"
	httpUtils "showurl/static-file/kplayer/apis/utils/http"
)

type RespGetMediaCurrent struct {
	CurrentMedia struct {
		Type        string  `json:"type"`
		Media       string  `json:"media"`
		Duration    float64 `json:"duration"`
		SeekTime    float64 `json:"seek_time"`
		Unique      string  `json:"unique"`
		CacheStatus bool    `json:"cache_status"`
	} `json:"current_media"`
}

func GetMediaCurrent() *RespGetMediaCurrent {
	resp := &RespGetMediaCurrent{}
	httpUtils.ParseResponseJsonBody(func(r *resty.Request) (*resty.Response, error) {
		return r.Get(config.Host + `/v1.1/player/media/current`)
	}, resp)
	return resp
}
/*
{
    "current_media": {
        "type": "solo",
        "media": "/root/movie1/水月洞天/19-21/《水月洞天》19-21集P3.mp4",
        "duration": 1887.36,
        "seek_time": 1765.92,
        "unique": "302CD30164BD94C3708CAF277991DD8E",
        "cache_status": false
    }
}
 */